/*
 * cache.h
 *
 *  Created on: 2012-7-3
 *  Author: zyh
 */

#include "lib/kernel/list.h"
#include "devices/block.h"

struct cache{
	struct list_elem elem;
	struct block* device;
	block_sector_t sector;
	void* buffer;
	bool accessed;
	bool dirty;
	bool exist;
};

void cache_init();
void write_to_cache(struct block* device,block_sector_t sector,int offset,int size,void* buffer);
void read_from_cache(struct block* device,block_sector_t sector,int offset,int size,void* buffer);
void write_all_to_block();
